home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / wsc4c21.zip / LINE.C < prev    next >
C/C++ Source or Header  |  1997-05-22  |  1KB  |  52 lines

  1. /*** line.c ***/
  2.  
  3. #include "windows.h"
  4. #include "wsc.h"
  5.  
  6. #include "line.h"
  7. #include "sioerror.h"
  8.  
  9. extern HWND hMainWnd;
  10. extern int  FatalFlag;
  11. extern int  OnLineFlag;
  12.  
  13. /*** PRIVATE ***/
  14.  
  15. static int ErrorCheck(int Code,char *Text)
  16. {if(Code<0) SioError(Code,Text);
  17.  return Code;
  18. }
  19.  
  20. /*** PUBLIC ***/
  21.  
  22. int GoOnLine(int Port, int BaudCode, int RxQueSize, int TxQueSize)
  23. {int RetCode;
  24.  char Temp[50];
  25.  if(OnLineFlag) return TRUE;
  26.  /* reset Port */
  27.  RetCode = SioReset(Port,RxQueSize,TxQueSize);
  28.  if(RetCode<0)
  29.    {wsprintf((LPSTR)Temp,"SioReset:COM%d",1+Port);
  30.     SioError(RetCode,Temp);
  31.     return FALSE;
  32.    }
  33.  /* set baud rate */
  34.  ErrorCheck( SioBaud(Port,BaudCode), "SioBaud");
  35.  /* clear receive buffer */
  36.  ErrorCheck( SioRxClear(Port), "SioRxClear");
  37.  /* set DTR & RTS */
  38.  ErrorCheck( SioDTR(Port,'S'), "SioDTR");
  39.  ErrorCheck( SioRTS(Port,'S'), "SioRTS");
  40.  /* no flow control */
  41.  ErrorCheck( SioFlow(Port,'N'), "SioFlow");
  42.  /* we're done */
  43.  OnLineFlag = TRUE;
  44.  return TRUE;
  45. }
  46.  
  47. void GoOffLine(int Port)
  48. {SioDone(Port);
  49.  /* we're done */
  50.  OnLineFlag = FALSE;
  51. }
  52.